<template>
	<view :class="themeName">
		<view class="tabstop">
			<u-tabs :list="tabsList" :is-scroll="false" :height="80" :active-color="themeColor" :bar-style="{ top: '100%' }" :current="tabsIndex" @change="changeCurrentTab" />
		</view>
		
		<mescroll-uni ref="mescrollRef" bgColor="white" top="90" 
		@init="mescrollInit" :down="{ auto: false }" :up="upOption" @down="downCallback" @up="upCallback">
			<view class="store-container">
				<view v-for="(item, index) in lists" :key="index" class="store-item m-b-20" @click="detail(item.id)">
					<view class="flex row-between m-t-20">
						<view class="back">
							<view class="bold">{{item.shop_name}}</view>
							<view>提现金额：{{item.money}}</view>
							<view>手续费：{{item.handling_fee}}</view>
							<view>到账金额：<text style="color: #0980CC;">{{item.left_money}}</text></view>
							<view>提现类型：
							<text v-if="item.type==1">钱包余额</text>
							<text v-else-if="item.type==2">微信零钱</text>
							<text v-else-if="item.type==3">银行卡</text>
							<text v-else-if="item.type==4">微信收款码</text>
							<text v-else-if="item.type==5">支付宝收款码</text></view>
							<view>提现备注：{{item.apply_remark?item.apply_remark:'空'}}</view>
							<view>申请时间：{{item.time}}</view>
							<view v-if="item.audit_remark">审核备注：{{item.audit_remark?item.audit_remark:''}}</view>
						</view>
					</view>
				</view>
			</view>
			<loading-view v-if="loading"></loading-view>
		</mescroll-uni>
		
	</view>
</template>

<script>
	import MescrollMixin from '@/components/mescroll-uni/mescroll-mixins.js';
	import { shoptixianLists } from '@/api/others.js';
	export default {
		mixins: [MescrollMixin],
		data() {
			return {
				// Tabs列表
				tabsList: [
					{
						sign: 1,
						name: '待提现'
					},
					{
						sign: 2,
						name: '提现中'
					},
					{
						sign: 3,
						name: '提现成功'
					},
					{
						sign: 4,
						name: '提现失败'
					}
				],
				tabsIndex: 0, // Tabs索引
				
				loading: true,
				lists: [
					// {status:1},
					// {},
					// {},
					// {}
				],
				upOption: {
					auto: false, // 不自动加载
					noMoreSize: 4, //如果列表已无数据,可设置列表的总数量要大于半页才显示无更多数据;避免列表数据过少(比如只有一条数据),显示无更多数据会不好看; 默认5
					empty: {
						icon: '/static/images/empty/order.png',
						tip: '暂无数据', // 提示
						fixed: true,
						top: '200rpx'
					}
				}
			};
		},
		onShow() {
			this.$nextTick(() => {
				this.mescroll.resetUpScroll();
			});
		},
		methods: {
			// 更改当前Tab页
			changeCurrentTab(index) {
				this.tabsIndex = index;
				this.refreshOrderData();
			},
			
			// 刷新订单数据 @Mixins【/src/mixins/order.js】内调用，请勿删除
			refreshOrderData() {
				this.$nextTick(() => {
					this.mescroll.resetUpScroll();
				});
			},
			// 下拉刷新
			downCallback() {
				this.upCallback({
				    num: 1,
				    size: 10
				});
			},
			// 上拉加载
			upCallback({ num, size }) {
				shoptixianLists({
					status:this.tabsList[this.tabsIndex].sign,
					page_no: num,
					page_size: size
				})
					.then((res) => {
						if (num == 1) this.lists = []; //如果是第一页需手动置空列表
						this.lists = this.lists.concat(res.lists); //追加新数据
						this.mescroll.endSuccess(res.lists.length, res.count);
						setTimeout(() => {
							this.loading = false;
						}, 500);
					})
					.catch((err) => {
						this.mescroll.endErr()
					});
			},
			detail(id){
				uni.navigateTo({
					url:'/others/pages/manager/examinedetail?id='+id
				})
			}
		}
	};
</script>

<style lang="scss" scoped>
	.tabstop{
		position: relative;
		z-index: 2;
	}
	.heads {
		padding: 20rpx;
		position: relative;
		z-index: 2;
		background: #F6F6F6;
		.h1 {
			background-color: #fff;
			padding: 0rpx 30rpx;
			border-radius: 15rpx;
			margin-right: 30rpx;
			border: 1px solid #eee;
			height: 67rpx;
			line-height: 67rpx;
		}

		.h2 {
			border: 1px solid #0980CC;
		}
	}
	.store-container {
		position: relative;
		z-index: 1;
		.store-item {
			background-color: white;
			padding: 20rpx 30rpx;
			border-radius: 10rpx;
			
			.tg{
				background-color: #0980CC;
				border: 1px solid #0980CC;
				border-radius: 35rpx;
				padding: 5rpx 25rpx;
				color: #fff;
			}
			.bh{
				border: 1px solid #0980CC;
				border-radius: 35rpx;
				padding: 5rpx 25rpx;
				color: #878787;
				margin-top: 30rpx;
			}
		}
	}
</style>